package com.hp.spring3apptest.spring.ui.validators;

import org.springframework.stereotype.Component;
import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;
import com.hp.spring3apptest.spring.ui.components.StudentLogin;

@Component
public class StudentLoginValidator implements Validator {

    @Override
    public boolean supports(Class<?> arg0) {
        return StudentLogin.class.isAssignableFrom(arg0);
        //return false;
    }

    @Override
    public void validate(Object target, Errors errors) {
        //ValidationUtils.rejectIfEmptyOrWhitespace(errors, "userName", "error.studentlogin.name");
        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "userPassword", "password.empty");
        
        
    }

}
